home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / Prog / B-C / C++ FAQ Reference 1.0 / C++ FAQ Reference 1.0.rsrc / TEXT_1044.txt < prev    next >
Encoding:
Text File  |  1993-06-30  |  685 b   |  3 lines

  1. A constructor turns raw bits into a living object.  Until the ctor has finished, you don't have a complete 'object'.  In particular, while the base class' ctor is working, the object isn't yet a Derived class object, so the call of the base class' virtual fn defn is correct.
  2.  
  3. Similarly dtors turn a living object into raw bits (they 'blow it to bits'), so the object is no longer a Derived during Base's dtor.  Therefore the same thing happens: when Base::~Base() calls 'virt()', Base::virt() gets control, not the Derived::virt() override.  (Think of what would happen if the Derived fn touched a subobject from the Derived class, and you'll quickly see the wisdom of the approach).